package com.stars.home.service;


import android.text.TextUtils;
import android.util.Log;

import com.google.gson.JsonObject;
import com.trailer.base.utils.S;

/**
 * Created by shihuiyun
 * on 2019-12-20
 */
public class SocketUtils {


    public static void initRoom(String uid) {
        //初始化
            JsonObject jsonObject = new JsonObject();
            jsonObject.addProperty("cmd", "init");
            JsonObject data = new JsonObject();
            data.addProperty("uid", uid);
            jsonObject.add("data", data);

            String jsonFormat = jsonObject.toString();

            MsgService.getInstance().send(jsonFormat);

    }


    /**
     * @param gid
     * @param type 1进入 2退出
     */
    public static void readNum(String gid,String type) {

        if (!TextUtils.isEmpty(new S().getString("uid"))) {
            JsonObject jsonObject = new JsonObject();
            jsonObject.addProperty("cmd", "Group_setReadUid_C");

            JsonObject data = new JsonObject();


            data.addProperty("uid", new S().getString("uid"));
            data.addProperty("gid",gid);
            data.addProperty("type",type);


            jsonObject.add("data", data);

            String jsonFormat = jsonObject.toString();

            Log.e("-ss--", "jsonFormat=: "+jsonFormat );

            MsgService.getInstance().send(jsonFormat);
        }

    }





}
